<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
 <head>
  <title>销售价格</title>
  <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  <script type="text/javascript">
  //编写自定义JS代码
  $(document).ready(function() {
      $("select[name='cusType']").change(function() { SelectcusTypeChange(); });

      //绑定下拉框change事件，当下来框改变时调用 SelectChange()方法
      $("select[name='cusCode']").change(function() { SelectChange(); });

  })
function SelectcusTypeChange() {
    var selectValue = $("select[name='cusType']").val();
    $("select[name='cusCode']").find("option").remove();
    $("select[name='gdCode']").find("option").remove();


    //加载工地
    var url = "tKpGongdiController.do?getCusList&cusType="+selectValue;
    $.ajax({
        url:url,
        type:"GET",
        dataType:"JSON",
        async: false,
        success:function(data){
            if(data.success){
                var cusList = data.attributes.cusList;
                if(cusList.length > 0){
                    for(var i=0;i<cusList.length;i++){
                        var value = cusList[i].value;
                        var text = cusList[i].text;

                        $("select[name='cusCode']").append("<option value='"+value+"'>"+text+"</option>");
                    }
                }

            }
        }
    });
}
  function SelectChange() {

      //获取下拉框选中项的text属性值

      var selectText = $("select[name='cusCode']").find("option:selected").text();



      //获取下拉框选中项的value属性值

      var selectValue = $("select[name='cusCode']").val();

console.log(selectValue);

      $("select[name='gdCode']").find("option").remove();


      //加载工地
      var url = "tKpGongdiController.do?getGongdiList&cusCode="+selectValue;
      $.ajax({
          url:url,
          type:"GET",
          dataType:"JSON",
          async: false,
          success:function(data){
              if(data.success){
                  var gongdiList = data.attributes.gongdiList;
                  if(gongdiList.length > 0){
                      for(var i=0;i<gongdiList.length;i++){
                          var value = gongdiList[i].value;
                          var text = gongdiList[i].text;

                          $("select[name='gdCode']").append("<option value='"+value+"'>"+text+"</option>");
                      }
                  }

              }
          }
      });

  }


  </script>
 </head>
 <body>
  <t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" action="tKpJiageController.do?doAdd" >
					<input id="id" name="id" type="hidden" value="${tKpJiagePage.id }"/>
	  <%--<input id="cusCode" name="cusCode" type="hidden" value="${tKpJiagePage.cusCode }"/>--%>
	  <%--<input id="gdCode" name="gdCode" type="hidden" value="${tKpJiagePage.gdCode }"/>--%>
	  <input id="cpCode" name="cpCode" type="hidden" value="${tKpJiagePage.cpCode }"/>

	  <table style="width: 600px;" cellpadding="0" cellspacing="1" class="formtable">
		  <tr>
			  <td align="right">
				  <label class="Validform_label">
					  客户类型:
				  </label>
			  </td>
			  <td class="value">
				  <t:dictSelect field="cusType" type="list"  typeGroupCode="cus_type"    hasLabel="false"  title="客户类型" ></t:dictSelect>
				  <span class="Validform_checktip"></span>
				  <label class="Validform_label" style="display: none;">客户类型</label>
			  </td>
		  </tr>
				<tr>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--客户编码:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
							<%--<input id="cusCode" name="cusCode" type="text" style="width: 150px" class="searchbox-inputtext" datatype="*" ignore="checked"   ignore="ignore"   onclick="popupClick(this,'cus_code,cus_name','cusCode,cusName','pop_kp_cus')"  />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">客户编码</label>--%>
						<%--</td>--%>
					<td align="right">
						<label class="Validform_label">
							客户名称:
						</label>
					</td>
					<td class="value">
						<t:dictSelect extendJson="{datatype:'*'}" field="cusCode"  dictTable="t_kp_cus"    dictField="cus_code" dictText="cus_name"   title="客户名称"></t:dictSelect>
						<%--<input id="cusName" name="cusName" type="text" datatype="*" ignore="checked"  style="width: 150px" class="inputxt" onclick="popupClick(this,'cus_code,cus_name','cusCode,cusName','pop_kp_cus')"   ignore="ignore" />--%>
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">客户名称</label>
						</td>


					<td align="right">
						<label class="Validform_label">
							承建单位:
						</label>
					</td>
					<td class="value">
						<t:dictSelect extendJson="{datatype:'*'}"  field="gdCode"  dictTable="t_kp_gongdi"   dictField="gd_code" dictText="gd_name" title="工地名称"></t:dictSelect>
						<%--<input id="gdName" name="gdName" datatype="*" ignore="checked"  type="text" style="width: 150px" class="inputxt"  ignore="ignore" onclick="popupClick(this,'gd_code,gd_name','gdCode,gdName','pop_kp_gongdi')"  />--%>
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">承建单位</label>
						</td>
					</tr>
				<tr>

					<td align="right">
						<label class="Validform_label">
							产品名称:
						</label>
					</td>
					<td class="value">
					     	 <input id="cpName" name="cpName" datatype="*" ignore="checked"  type="text" style="width: 150px" class="inputxt"  ignore="ignore"  onclick="popupClick(this,'cp_code,cp_name,cp_guige,cp_dengji,cp_jifei','cpCode,cpName,by2,by3,by4','pop_kp_chanpin')"/>
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">产品名称</label>
						</td>

					<td align="right">
						<label class="Validform_label">
							开票价格:
						</label>
					</td>
					<td class="value">
						<input id="cpDshenjia" name="cpDshenjia" datatype="*" ignore="checked"   type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
						<span class="Validform_checktip"></span>
						<label class="Validform_label" style="display: none;">价格</label>
					</td>
					</tr>

		  <tr>
			  <td align="right">
				  <label class="Validform_label">
					  出厂价:
				  </label>
			  </td>
			  <td class="value">
				  <input    id="chuchangfei" name="chuchangfei" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
				  <span class="Validform_checktip"></span>
				  <label class="Validform_label" style="display: none;">出厂价</label>
			  </td>

			  <td align="right">
				  <label class="Validform_label">
					  运输费:
				  </label>
			  </td>
			  <td class="value">
				  <input id="yunshufei" name="yunshufei" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
				  <span class="Validform_checktip"></span>
				  <label class="Validform_label" style="display: none;"> 运输费</label>
			  </td>
		  </tr>

				<tr>
						<td align="right">
						<label class="Validform_label">
						单位:
						</label>
						</td>
						<td class="value">
						<input readonly="readonly"  id="by4" name="by4" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
						<span class="Validform_checktip"></span>
						<label class="Validform_label" style="display: none;">单位</label>
						</td>

						<td align="right">
							<label class="Validform_label">
								备注:
							</label>
						</td>
						<td class="value">
							<input id="jgRemark" name="jgRemark" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">备注</label>
						</td>
					</tr>
			  <tr>

			  <td align="right">
			  <label class="Validform_label">
			  规格:
			  </label>
			  </td>
			  <td class="value">
			  <input  readonly="readonly"  id="by2" name="by2" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
			  <span class="Validform_checktip"></span>
			  <label class="Validform_label" style="display: none;">规格</label>
			  </td>
				  <td align="right">
					  <label class="Validform_label">
						  等级:
					  </label>
				  </td>
				  <td class="value">
					  <input readonly="readonly" id="by3" name="by3" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
					  <span class="Validform_checktip"></span>
					  <label class="Validform_label" style="display: none;">等级</label>
				  </td>
			  </tr>
				<%--<tr>--%>

					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--申请备注:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="sqRemark" name="sqRemark" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">申请备注</label>--%>
						<%--</td>--%>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--审批备注:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
						<%--<input id="spRemark" name="spRemark" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
						<%--<span class="Validform_checktip"></span>--%>
						<%--<label class="Validform_label" style="display: none;">审批备注</label>--%>
					<%--</td>--%>
					<%--</tr>--%>
				<%--<tr>--%>

					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--备用1:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="by1" name="by1" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">备用1</label>--%>
						<%--</td>--%>
					<%--</tr>--%>
				<%--<tr>--%>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--备用2:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="by2" name="by2" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">备用2</label>--%>
						<%--</td>--%>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--备用3:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="by3" name="by3" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">备用3</label>--%>
						<%--</td>--%>
					<%--</tr>--%>
				<%--<tr>--%>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--备用4:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="by4" name="by4" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">备用4</label>--%>
						<%--</td>--%>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--备用5:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="by5" name="by5" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">备用5</label>--%>
						<%--</td>--%>
					<%--</tr>--%>
				
				
			</table>
		</t:formvalid>
 </body>
  <script src = "webpage/com/yserp/kpmd/tKpJiage.js"></script>		
